@include('admin.layout.css')
@include('admin.layout.js')




<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">商家名称</label>
        <div class="layui-input-block">
            <input type="text"  name="shop_name"  placeholder="请输入商家名称" autocomplete="off" class="layui-input" >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">商家联系手机号</label>
        <div class="layui-input-block">
            <input type="text"  name="shop_phone"  placeholder="请输入商家联系手机号" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">抽佣类型</label>
        <div class="layui-input-block">
            <input type="radio" lay-filter="shop_type" name="shop_type" value="1" title="统一抽佣" checked>
{{--            <input type="radio" lay-filter="shop_type" name="shop_type" value="2" title="商品单独抽佣" >--}}
        </div>
    </div>

    <div class="layui-form-item" id="show_input">
        <label class="layui-form-label">商家统一抽佣(小于1)</label>
        <div class="layui-input-block">
            <input type="text"  name="shop_value_yong"  placeholder="请输入商家统一抽佣" autocomplete="off" class="layui-input" >
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">代理用户id</label>
        <div class="layui-input-inline">
            <input type="text"  name="user_daili_id"  placeholder="请输入代理用户id" autocomplete="off" class="layui-input" >
        </div>


        <label class="layui-form-label">销售奖</label>
        <div class="layui-input-inline">
            <input type="text"  name="xiaoshoujiang"  placeholder="请输入销售奖" autocomplete="off" class="layui-input" >
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">点位奖</label>
        <div class="layui-input-inline">
            <input type="text"  name="point_uid_price"  placeholder="请输入点位奖" autocomplete="off" class="layui-input" >
        </div>


        <label class="layui-form-label">点位上级奖</label>
        <div class="layui-input-inline">
            <input type="text"  name="point_uid_two_price"  placeholder="请输入点位上级奖" autocomplete="off" class="layui-input" >
        </div>
    </div>


    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="submit" id="submit" value="确认">
        <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="取消">
    </div>

</div>


<script>



    layui.use(['laydate','form'], function() {
        let form = layui.form;

        form.on('radio(shop_type)', function(data){
            if(data.value == '1'){
                $("#show_input").css('display','')
            }else{
                $("#show_input").css('display','none')
            }
        });


        form.on('submit(submit)', function(data){
            console.log(data)
            if(data.field['shop_type'] == 2){
                data.field['shop_value_yong'] = 0;
            }

            Api.add("{{route('admin.shop.add')}}",data.field,function(res){
                if (res.code !== 200){
                    Utils.errorToast(res.msg);
                    return;
                }
            });
        });


    });
</script>
